<template>
  <div class="personalContainer">
    <!-- 头部 -->
    <div class="header" @click="toRegister">
      <div class="background">
        <div class="info">
          <div class="left">
            <img
              class="avater"
              src="https://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png"
            />
          </div>
          <div class="center">
            <p class="nickName">{{ userInfo ? userInfo.nickName : '用户' }}</p>
            <div class="ordinary-user">
              <span>普通用户</span>
            </div>
          </div>
        </div>
        <div class="right">
          <i class="qr-code"></i>
        </div>
      </div>
    </div>

    <!-- 我的资产 -->
    <div class="myAsset">
      <h2 class="title">我的资产</h2>
      <div class="assetList">
        <div class="assetItem">
          <p class="assetCount">
            <span class="unit">¥</span>
            <span class="value">0</span>
          </p>
          <p class="assetName">余额</p>
        </div>
        <div class="assetItem">
          <p class="assetCount">
            <span class="value">0</span>
          </p>
          <p class="assetName">红包</p>
        </div>
        <div class="assetItem">
          <p class="assetCount">
            <span class="value">0</span>
          </p>
          <p class="assetName">优惠券</p>
        </div>
        <div class="assetItem">
          <p class="assetCount">
            <span class="value">0</span>
          </p>
          <p class="assetName">积分</p>
        </div>
        <div class="assetItem">
          <p class="assetCount">
            <span class="value">0</span>
          </p>
          <p class="assetName">礼品卡</p>
        </div>
      </div>
    </div>
    <!-- 内容 -->
    <div class="contentContainer">
      <div class="list">
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-wodedingdan"></i>
            <span class="txt">我的订单</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-geren"></i>
            <span class="txt">账号管理</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-shouji"></i>
            <span class="txt">我的手机号</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-rili"></i>
            <span class="txt">周六一起拼</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-tuihuoshouhou"></i>
            <span class="txt">售后服务</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-yaoqinghaoyou"></i>
            <span class="txt">邀请返利</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-youxiangou"></i>
            <span class="txt">优先购</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-qian"></i>
            <span class="txt">积分中心</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-huiyuan"></i>
            <span class="txt">会员俱乐部</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-dizhi"></i>
            <span class="txt">地址管理</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-24gl-shieldCheck"></i>
            <span class="txt">支付安全</span>
          </div>
        </div>
        <div class="list-item">
          <div class="item">
            <i class="iconfont icon-erji"></i>
            <span class="txt">帮助与客服</span>
          </div>
        </div>
        <div class="list-item item-bottom">
          <div class="item">
            <i class="iconfont icon-yijianfankui"></i>
            <span class="txt">意见反馈</span>
          </div>
        </div>
        <div class="list-item item-bottom">
          <div class="item">
            <i class="iconfont icon-sifapaimai"></i>
            <span class="txt">我的竞拍</span>
          </div>
        </div>
      </div>
    </div>
    <!-- 退出登录 -->
    <div class="layout">
      <van-button type="default" block @click="toHome">退出登录</van-button>
    </div>

  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      userInfo :{}
    };
  },
  methods:{
    //跳到注册页面
    toRegister(){
      this.userInfo ? '' : this.$router.push('/register')
    },

    //退出登录跳回首页
    toHome(){
      localStorage.removeItem('userInfo');
      localStorage.removeItem('token')
      this.$router.push('/home')
    }
  },
  mounted() {
    const userInfo = JSON.parse(localStorage.getItem('userInfo'))
    this.userInfo = userInfo
  }
};
</script>

<style lang="less" scoped>
.personalContainer {
  background: #eee;
  overflow: hidden;
  // 头部
  .header {
    .background {
      width: 100%;
      height: 3.6rem;
      background-size: 100%;
      background-image: url(https://yanxuan.nosdn.127.net/5905098f74e04c39fa5e76ebb9ff591b.png);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 0.5rem;
      box-sizing: border-box;
      .info {
        display: flex;
        align-items: center;
        .left {
          padding: 0.64rem 0;
          margin-right: 0.5rem;
          .avater {
            border-radius: 50%;
            width: 1.9rem;
            height: 1.9rem;
            vertical-align: middle;
          }
        }
        .center {
          color: #fff;
          line-height: 1.2;
          text-align: left;
          margin-bottom: 0.1rem;
          text-overflow: ellipsis;
          white-space: nowrap;
          overflow: hidden;
          .nickName {
            font-size: 0.48rem;
          }
          .ordinary-user {
            font-size: 0.36rem;
            margin-top: 0.18rem;
          }
        }
      }
      .right {
        .qr-code {
          background-image: url("../../assets/images/erweima.webp");
          width: 0.64rem;
          height: 0.64rem;
          display: inline-block;
          background-position: -0.2rem -3.4rem;
          background-size: 1.2rem 19rem;
          background-repeat: no-repeat;
        }
      }
    }
  }

  // 我的资产
  .myAsset {
    background: #fff;
    border-bottom: ipx solid #f4f4f4;
    line-height: 16px;
    .title {
      font-size: 15px;
      margin-left: 16px;
      padding: 0.3rem;
      border-bottom: 1px solid #d9d9d9;
      font-weight: 400;
      line-height: 32px;
    }
    .assetList {
      display: flex;
      text-align: center;
      justify-content: space-around;
      position: relative;
      .assetItem {
        position: relative;
        padding-top: 24px;
        height: 60px;
        margin-bottom: 20px;
        line-height: 17px;
        .assetCount {
          margin-bottom: 8px;
          font-size: 16px;
          font-weight: 700;
          line-height: 12px;
          .unit {
            font-size: 12px;
          }
        }
        .assetName {
          font-size: 12px;
        }
      }
    }
  }

  //内容
  .contentContainer {
    width: 375px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 10px;
    border-bottom: 1px solid #fff;
    margin-bottom: 20px;
    .list {
      display: flex;
      flex-wrap: wrap;
      background: #fff;
      .list-item {
        width: 33.33%;
        border-right: 1px solid rgba(0, 0, 0, 0.15);
        border-bottom: 1px solid rgba(0, 0, 0, 0.15);
        &.item-bottom {
          border-bottom: none;
        }
        .item {
          padding: 17px 0;
          text-align: center;
          .iconfont {
            width: 22px;
            height: 22px;
            vertical-align: middle;
            margin-bottom: 12px;
            font-size: 25px;
            color: #aaa;
          }
          .txt {
            font-size: 12px;
            display: block;
            margin-top: 5px;
          }
        }
      }
    }
  }

  //退出登录
  .layout {
    width: 375px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 70px;
    overflow: hidden;
  }

}
</style>